<?php
/**
 * Created by JetBrains PhpStorm.
 * User: FuXiaoHei
 * Date: 13-6-1
 * Time: 上午12:39
 * To change this template use File | Settings | File Templates.
 */

namespace Blog\Model;


use Hx\Mvc\Model\Table;

class Option extends Table{


    public function __construct(){
        $this->setTable('fxh_option');
    }

    public function getAutoLoad(){
        $options = $this->select(array(
            'where'=>'isAuto = 1'
        ),'name,value,type,isJson');
        foreach($options as $k=>$o){
            if($o->isJson > 0){
                $o->value = json_decode($o->value);
            }
            $options[$o->type][$o->name] = $o->value;
            unset($options[$k]);
        }
        return $options;
    }
}